# -*- coding = utf-8 -*-
# @Time : 2022/1/12 19:50
# @Author : GHHHHHHHHH
# @File : generateMap.py
# @Software : PyCharm

import cv2
import numpy as np


def generateMap(image, xLength, yLength):
    edges = cv2.Canny(image, 30, 70)
    img = np.expand_dims(edges, axis=2)
    img = np.concatenate((img, img, img), axis=-1)
    for i in range(xLength):
        for j in range(yLength):
            if tuple(img[i][j])[0] > 200 and tuple(img[i][j])[1] > 200 and tuple(img[i][j])[2] > 200:
                img[i][j] = (255, 255, 255)
            elif tuple(img[i][j])[0] < 50 and tuple(img[i][j])[1] < 50 and tuple(img[i][j])[2] < 50:
                img[i][j] = (0, 0, 0)
    return img
